﻿using System.ComponentModel;
using System.Windows.Input;
using Moonwish.Core.Command;

namespace Moonwish.Core
{
    public abstract class ViewModelMain : ObservableObject
    {
        protected ViewModelMain()
        {
            InitializationCommand = new RelayCommand(Initialization);
        }
        /// <summary>
        /// 页面加载命令属性。
        /// </summary>
        public ICommand InitializationCommand { get; set; }

        /// <summary>
        /// 页面加载方法。
        /// </summary>
        protected abstract void Initialization();

        /// <summary>
        /// 是否在设计时模式。
        /// </summary>
        public bool IsInDesignMode
        {
            get
            {
                return DesignerProperties.IsInDesignTool;
            }
        }

        private bool _isBusy;
        /// <summary>
        /// 页面忙状态。
        /// </summary>
        public virtual bool IsBusy
        {
            get { return _isBusy; }
            set
            {
                if (_isBusy != value)
                {
                    _isBusy = value;
                    RaisePropertyChanged(() => IsBusy);
                }
            }
        }
    }
}
